home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / os2 / pvm34b3.zip / pvm34b3 / pvm3 / src / mppchunk.h < prev    next >
C/C++ Source or Header  |  1997-07-22  |  6KB  |  181 lines

  1.  
  2. /* $Id: mppchunk.h,v 1.5 1997/07/09 13:52:35 pvmsrc Exp $ */
  3.  
  4. /*
  5.  *         PVM version 3.4:  Parallel Virtual Machine System
  6.  *               University of Tennessee, Knoxville TN.
  7.  *           Oak Ridge National Laboratory, Oak Ridge TN.
  8.  *                   Emory University, Atlanta GA.
  9.  *      Authors:  J. J. Dongarra, G. E. Fagg, M. Fischer
  10.  *          G. A. Geist, J. A. Kohl, R. J. Manchek, P. Mucci,
  11.  *         P. M. Papadopoulos, S. L. Scott, and V. S. Sunderam
  12.  *                   (C) 1997 All Rights Reserved
  13.  *
  14.  *                              NOTICE
  15.  *
  16.  * Permission to use, copy, modify, and distribute this software and
  17.  * its documentation for any purpose and without fee is hereby granted
  18.  * provided that the above copyright notice appear in all copies and
  19.  * that both the copyright notice and this permission notice appear in
  20.  * supporting documentation.
  21.  *
  22.  * Neither the Institutions (Emory University, Oak Ridge National
  23.  * Laboratory, and University of Tennessee) nor the Authors make any
  24.  * representations about the suitability of this software for any
  25.  * purpose.  This software is provided ``as is'' without express or
  26.  * implied warranty.
  27.  *
  28.  * PVM version 3 was funded in part by the U.S. Department of Energy,
  29.  * the National Science Foundation and the State of Tennessee.
  30.  */
  31.  
  32. #ifndef __mppchunk_h__
  33. #define __mppchunk_h__
  34.  
  35. #include "mppmsg.h"
  36. /* exportable parameters */
  37. extern int MAXSEQ;        /* from mppchunk.c */
  38.  
  39. /* Some parameters that should be made runtime/startup changeable */
  40.  
  41. #define TAGBASE 
  42. #define NRBUFS 4
  43. #define NSBUFS 4
  44. #define DFN_MAXSEQ 0xffff
  45.  
  46. #define INCRSEQ(_seq,_maxseq) (((_seq)++)&(_maxseq))
  47. #define NEXTCHUNKSEQ(_seq, _delta) (((_seq) + (_delta)) & 0xffff )
  48.  
  49.  
  50. /*  array of mids of outstanding messages to be sent to backend */
  51. #define NMPPSBUFMIDS 32
  52. #define MPPMIDFREE -1
  53. #define MPPMIDALLOCED -2
  54.  
  55. #if !defined(IMA_NODE)
  56. #define CHUNK struct pkt
  57. #define CHUNK_NEW pk_new
  58. #define CHUNK_NEXT pk_link
  59. #define CHUNK_PREV pk_rlink
  60. #define CHUNK_SEQ pk_seq
  61. #define CHUNK_SRC pk_src
  62. #define CHUNK_LEN pk_len
  63. #define CHUNK_DAT pk_dat
  64. #define CHUNK_MAX pk_max
  65. #define CHUNK_FREE pk_free
  66. #define CHUNK_RIP    pk_rip
  67. #include "pkt.h"
  68. #else
  69. #define CHUNK struct frag
  70. #define CHUNK_NEW fr_new
  71. #define CHUNK_NEXT fr_link
  72. #define CHUNK_PREV fr_rlink
  73. #define CHUNK_SEQ fr_seq
  74. #define CHUNK_SRC fr_src
  75. #define CHUNK_LEN fr_len
  76. #define CHUNK_DAT fr_dat
  77. #define CHUNK_MAX fr_max
  78. #define CHUNK_FREE fr_unref
  79. #define CHUNK_RIP fr_rip
  80. #include "pvmfrag.h"
  81. #endif
  82.  
  83. /* ======== Type declarations ========= */
  84. typedef CHUNK *CHUNK_PTR;
  85.  
  86. /* Information used for sending/receiving packets to/from tasks. 
  87. Keeps track of the send sequence number and the tagbase used for '
  88. sending data. Points to a pkt_order structure for receives so that
  89. reordering happens in a sane manner.
  90. */
  91.  
  92. struct mpp_directi
  93. {
  94.     int rtid;            /* task id of the remote task sender/receiver */
  95.     int rpid;            /* pid of the remote proc, used by puma */
  96.     int appid;            /* used for by  PUMA for host to node send */
  97.     int tagbase;        /* base for sending/receive messages */
  98.     int nbufs;            /* nbuffers to use before wrap */
  99.     int sseq;            /* sequence number to use for send */
  100.     struct chunk_order *ordering; /* ordering structure for receive sequencing */ 
  101. };
  102.  
  103. typedef struct mpp_directi MPP_DIRECTI;
  104. typedef struct mpp_directi *MPP_DIRECTI_PTR;
  105.  
  106. struct chunk_order 
  107. {
  108.     int seq;            /* sequence number for  this task */
  109.     int nbufs;            /* number of buffers that we have to sequence */    
  110.     int *bufseq;        /* sequence number of the ith buffer for this task */
  111.     CHUNK *oochunks;    /* list of out-of-order packets */    
  112. };                
  113.  
  114. typedef struct chunk_order CHUNK_ORDER;
  115. typedef struct chunk_order *CHUNK_ORDER_PTR;
  116.  
  117.  
  118.  
  119. struct msg_info
  120. {
  121.     int mid;            /* message id from message-passing substrate */
  122.     CHUNK *rchunk;        /* posted chunk for receive */
  123.     int src;            /* source for this message */
  124.     int tag;            /* tag for this message */
  125.     int mxsize;            /* max size of the message */
  126.     int hsize;            /* size of header */
  127.     info_t info[MPPINFOSIZE];        /* info array 8 for pgons, 1 for MPI */
  128.     
  129. };
  130.  
  131. typedef struct msg_info MSG_INFO;
  132. typedef struct msg_info *MSG_INFO_PTR;
  133.  
  134. /* ----- Prototype Declarations ------- */
  135.  
  136. /* ====== Functions that return MPP_DIRECTI_PTR structs ======= */
  137.  
  138. MPP_DIRECTI_PTR new_directstruct __ProtoGlarp__( (int, int) );
  139.             /* int nsbufs -- number of send buffers 
  140.             *  int nrbufs -- number of receive buffers
  141.             */
  142. MPP_DIRECTI_PTR new_vdirectstruct __ProtoGlarp__( (int nstructs, int nsbufs, int nrbufs) );
  143.             /* int nstructs -- number of structures to alloc 
  144.             *  int nsbufs -- number of send buffers 
  145.             *  int nrbufs -- number of receive buffers
  146.             */ 
  147.  
  148. /* ====== Functions that return CHUNK_ORDER_PTR  ======= */
  149.  
  150. CHUNK_ORDER_PTR new_chunkostruct __ProtoGlarp__( (int nbufs) );
  151.             /* nbufs -- number of receive buffers */
  152.     
  153. CHUNK_ORDER_PTR new_vchunkostruct __ProtoGlarp__( (int nstructs, int nbufs) );
  154.             /* nstructs -- number of structures
  155.             *  nbufs -- number of receive buffers 
  156.             */
  157.  
  158. /* ====== Functions that return struct CHUNK *  ======= */
  159. CHUNK_PTR ochunk_delete __ProtoGlarp__( (CHUNK_ORDER_PTR) );
  160. CHUNK_PTR read_chunk __ProtoGlarp__( (MSG_INFO_PTR, int *, int *, int *, int , int, MSGFUNC_PTR) );
  161.  
  162. /* ====== Functions that return MSG_INFO_PTR  ======= */
  163.  
  164. MSG_INFO_PTR init_recv_list __ProtoGlarp__( (int, int, int, int, int, MSGFUNC_PTR) );
  165.  
  166. /* ====== Functions that return int  ======= */
  167.  
  168. int init_directstruct __ProtoGlarp__( ( MPP_DIRECTI_PTR, int ));
  169. int order_chunk __ProtoGlarp__( (CHUNK_ORDER_PTR, int, CHUNK_PTR ));
  170. int ochunk_insert __ProtoGlarp__( (CHUNK_ORDER_PTR, CHUNK_PTR) );
  171. int post_receive __ProtoGlarp__( (MSG_INFO_PTR , int, int, int, int, int, int, MSGFUNC_PTR) );
  172. int post_send __ProtoGlarp__( (char * , int, MPP_DIRECTI_PTR, MSGFUNC_PTR) );
  173. int update_seq_numbers __ProtoGlarp__( (CHUNK_ORDER_PTR) );
  174. int pvm_init_asynch_list __ProtoGlarp__( (msgmid_t *, CHUNK_PTR *, int) );
  175. int pvm_assign_chunk __ProtoGlarp__( (CHUNK_PTR *, CHUNK_PTR, int) );
  176. int pvm_assign_mid __ProtoGlarp__( (msgmid_t *, int, int) );
  177. int pvm_mpp_find_midx __ProtoGlarp__( (msgmid_t *, CHUNK_PTR *, int *, int, MSGFUNC_PTR) );
  178.  
  179. /* ====== Functions that return struct CHUNK *  ======= */
  180. #endif
  181.